package com.znjc.device.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.znjc.device.util.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * 逆变器
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("iot_nbq_data")
public class NbqData {

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 数据ids
     */
    private Timestamp ts;
    /**
     * 直流电压
     */
    private String zldy;
    /**
     * 交流电压
     */
    private String jldy;
    /**
     * 交流电流
     */
    private String jldl;
    /**
     * 频率
     */
    private String pl;
    /**
     * 温度1
     */
    private String wd1;
    /**
     * 温度2
     */
    private String wd2;
    @TableField(exist = false)
    private String tsString;

    public String getTsString(){
        try {
            return DateUtil.TimestampToString(this.getTs());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
